function [S] = UpdateS(X, V, r)
n = size(X,2);
VX = X' * V;
Lambda = zeros(n,n)+1e20*eye(n);
distx = EuDist2(VX,VX,0);
Lambda =Lambda + distx + eps;
l = 10;
for i=1:n
    [~,tmpid] = sort(Lambda(i,:),'ascend');
    Lambda(i,tmpid(1:l)) = Lambda(i,tmpid(1:l)).^(1/(1-r));
    Lambda(i,tmpid(l+1:end)) = 0;
end
sLambda = sum(Lambda,2);
S = Lambda./repmat(sLambda,1,size(Lambda,2));
clear Lambda;
end
